package 曾世昌12_8.zuoye20;

import java.lang.reflect.Constructor;

public class test {
    /**
     * 方法功能：执行某对象方法
     *
//     * @param obj        对象
//     * @param methodName 方法名
//     * @param args       参数数组
     * @return 方法返回值
     */
    public static void main(String[] args) throws Exception {
        person zsc = new person( "曾世昌" );
        Object[] arg={1,2,3,4};
       new test().invokeMethod( zsc, "1", arg );
    }
    public Object invokeMethod(Object obj, String methodName, Object[] args) throws Exception {
        Class<?> aClass = Class.forName( "rc.mxdx3_zhoumozuoye.zuoye19.Person" );
        Constructor<?> declaredConstructor = aClass.getDeclaredConstructor();
        declaredConstructor.setAccessible( true );
        Object o = declaredConstructor.newInstance();
        return o;
    }

}
